package drds.binlog.parse.mysql.ddl;

import drds.binlog.common.Authors;
import drds.binlog.data_object.EventType;
import drds.common.Author;
import lombok.Getter;
import lombok.Setter;

@Author(name = Authors.LI_YANG)
public class Ddl
{

    @Setter
    @Getter
    private String schemaName;
    @Setter
    @Getter
    private String tableName;
    //
    @Setter
    @Getter
    private String originalSchemaName;    // rename ddl中的源表
    @Setter
    @Getter
    private String originalTableName;     // rename ddl中的目标表
    //
    @Setter
    @Getter
    private EventType eventType;
    @Setter
    @Getter
    private Ddl renameTableResult; // 多个rename table的存储

    /*
     * RENAME TABLE tbl_name TO new_tbl_name [, tbl_name2 TO new_tbl_name2] ...
     */

    public Ddl()
    {
    }

    public Ddl(String schemaName)
    {
        this.schemaName = schemaName;
    }

    public Ddl(String schemaName, String tableName)
    {
        this.schemaName = schemaName;
        this.tableName = tableName;
    }

    public Ddl(String schemaName, String tableName, String originalSchemaName, String originalTableName)
    {
        this.schemaName = schemaName;
        this.tableName = tableName;
        this.originalSchemaName = originalSchemaName;
        this.originalTableName = originalTableName;
    }

    @Override
    public Ddl clone()
    {
        Ddl ddl = new Ddl();
        ddl.setSchemaName(schemaName);
        ddl.setTableName(tableName);
        ddl.setOriginalSchemaName(originalSchemaName);
        ddl.setOriginalTableName(originalTableName);

        // result.setEventType(eventType);
        return ddl;
    }


}
